package com.sunxu.ioc.java.beans;

import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;

/**
 * @author 孙许
 * @version 1.0
 * @date 2020/3/28 6:25 下午
 */
public class BeanInfoDemo {
    public static void main(String[] args) throws IntrospectionException {
        BeanInfo beanInfo = Introspector.getBeanInfo(Person.class, Object.class);

        for (PropertyDescriptor propertyDescriptor : beanInfo.getPropertyDescriptors()) {
            Class<?> propertyType = propertyDescriptor.getPropertyType();
            String propertyDescriptorName = propertyDescriptor.getName();
            if ("age".equals(propertyDescriptorName)) {
//                propertyDescriptor.setPropertyEditorClass();
            }
            System.out.println(propertyDescriptor);
        }
    }
}
